<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            margin: 0px;
            padding: 0px;
        }

        body>div {
            margin: 0px auto;
            width: 600px;
            height: 600px;
        }
    </style>
</head>

<body>
    <div>
        输入框:<input type="text" id="d1"> <br>
        文本域:<textarea id="d2" cols="30" rows="10"></textarea><br>
        <button onclick="getValue()">获取</button>
    </div>
    <script>
        function getValue() {
            const myself = this;
            const valInput =document.getElementById('d1').value;
            const valText =document.getElementById('d2').value;
            console.log('valInput', valInput,'valText',valText);

            
        }
    </script>
</body>

</html>